package com.smart.admin.service.impl;


import cn.hutool.core.bean.BeanUtil;
import com.smart.admin.common.request.CouponRequestParam;
import com.smart.admin.entity.Coupon;
import com.smart.admin.mapper.CouponMapper;
import com.smart.admin.service.CouponService;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @author zhangwei
 */
public class CouponServiceImpl implements CouponService {
    @Resource
    private CouponMapper couponMapper;

    @Override
    @Transactional(timeout = 2, rollbackFor = RuntimeException.class)
    public int add(CouponRequestParam couponRequestParam) {
        int flag = 0;
        Coupon coupon = new Coupon();
        BeanUtil.copyProperties(couponRequestParam, coupon);
        int couponCount = couponMapper.insert(coupon);
        if (couponCount > 0) {
            
        }
        return flag;
    }
}
